<template>
  <div class="search-wrapper">
    <swiper :options="swiperOption">
      <swiperSlide v-for="(item,i) in slideList" :key="i">
        <img :src="item.logo">
      </swiperSlide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
    
    <div class="search-box">
      <img src="@/assets/images/search.png" alt="">
      <span @click="pageSearch">请输入商品名称进行搜索</span>
    </div>
  </div>
</template>

<script>
import { swiper, swiperSlide } from "vue-awesome-swiper";
import "swiper/dist/css/swiper.css";
export default {
  props: ["slideList"],
  components: {
    swiper,
    swiperSlide
  },

  data() {
    return {
      swiperOption: {
        //可选选项，自动滑动
        autoplay: {
          delay: 1000,
          disableOnInteraction: false
        },
        // 循环滚动
        loop: true,
        //轮播图分页
        pagination: {
          el: ".swiper-pagination",
          clickable: true
        }
      }
    };
  },
  methods: {
    pageSearch() {
      this.$router.push({
        path: "/search",
        query: {
          id: 1
        }
      });
    }
  },
  computed: {
    swiper() {
      return this.$refs.mySwiper.swiper;
    }
  }
};
</script>

<style lang="scss">
.search-wrapper {
  position: relative;
  height: 576px;
  overflow: hidden;
  .swiper-container {
    height: 576px;
    .swiper-wrapper {
      .swiper-slide {
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
  .search-box {
    z-index: 999;
    width: 900px;
    height: 80px;
    position: absolute;
    background: #fff;
    box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.13);
    border-radius: 10px;
    left: 50%;
    margin-left: -450px;
    top: 32px;

    img {
      vertical-align: middle;
      margin: 18px 24px 26px 30px;
    }

    span {
      font-size: 28px;
      color: #7f7f7f;
      line-height: 80px;
    }
  }
}
</style>
